package com.inspur.base;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import org.apache.log4j.Logger;
/**
 * JDBC 操作基类
 * @author apple
 *
 */
public abstract  class BaseJDBCDao{
    private static Logger log = Logger.getLogger(BaseJDBCDao.class);
    
    public void closeAllConnection(Connection connection,Statement pstmt,ResultSet rs) {
        try {
            if(rs != null) {
                rs.close();
            }
        } catch (SQLException e) {
            e.printStackTrace();
            log.error(e.getMessage());
        }finally {
            try {
                if(pstmt != null) {
                    pstmt.close();
                }
            } catch (SQLException e) {
                e.printStackTrace();
                log.error(e.getMessage());
            }finally{
                try {
                    if(connection != null) {
                        connection.close();
                    }
                } catch (SQLException e) {
                    e.printStackTrace();
                    log.error(e.getMessage());
                }
            }
        }
    }
    

}
